<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>服务详情</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1 {
            color: #333;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
        }
        .detail-item {
            margin-bottom: 15px;
        }
        .detail-label {
            font-weight: bold;
            color: #555;
        }
        .back-btn {
            display: block;
            width: 100%;
            padding: 12px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>服务详情</h1>
        <div class="detail-item">
            <span class="detail-label">项目名称: </span>
            <span id="name"></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">项目类别: </span>
            <span id="category"></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">完成情况: </span>
            <span id="status"></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">订单编号: </span>
            <span id="orderId"></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">服务人员: </span>
            <span id="servicePerson"></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">服务时间: </span>
            <span id="serviceTime"></span>
        </div>
        <button class="back-btn" onclick="window.history.back()">返回</button>
    </div>

    <script>
        // 从URL中获取参数
        function getQueryParams() {
            const params = {};
            const queryString = window.location.search.substring(1);
            console.log('查询字符串: ', queryString); // 用于调试
            const pairs = queryString.split('&');
            for (let i = 0; i < pairs.length; i++) {
                const pair = pairs[i].split('=');
                params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
            }
            console.log('解析的参数: ', params); // 用于调试
            return params;
        }

        // 显示详情信息
        function displayDetails() {
            const params = getQueryParams();
            document.getElementById('name').textContent = params.name || '未知';
            document.getElementById('category').textContent = params.category || '未知';
            document.getElementById('status').textContent = params.status || '未知';
            document.getElementById('orderId').textContent = params.orderId || '未知';
            document.getElementById('servicePerson').textContent = params.servicePerson || '未知';
            document.getElementById('serviceTime').textContent = params.serviceTime || '未知';
        }

        // 页面加载时显示详情
        window.onload = displayDetails;
    </script>
</body>
</html>